The present invention relates to a lock control for a data processing system, more particularly to a lock control in a data processing system with a plurality of data processing units sharing a main storage.
In a data processing system, a plurality of data processing units often share a main storage. For the above constitution, sometimes, the predetermined data processing unit has to access exclusively the data stored in a shared region, for a predetermined period of time. When a certain data processing unit operates to add "one" to the data stored in a certain shared region, for example, an access to this data from other data processing units must be inhibited, during a processing period that the data of the shared region is read out to add "one" and then the data is written to the shared region again. Without such control, an update result of data is not secured.
To secure this exclusive access, a lock variable is used. When accessing the shared region, the lock variable has to be checked to confirm that it is not in a lock state. If the lock variable is in an unlock state, it is changed to be the lock state to access to a corresponding shared region. After an exclusive processing is completed, the lock variable is restored to the unlock state. The control explained as above is called a lock control.
U.S. Pat. No. 4,733,352, for example, disclosed a data processing system including a plurality of storage control units, which perform a lock control to access a main storage from a plurality of processing units. In this prior art disclosed by the U.S. Patent, states of the lock variable are expressed using two ways: one is that a lock is acquired, and the other is that the lock is not acquired. The former is called a lock state, the latter is called an unlock state. Therefore, in a certain storage control unit, if a request for acquisition of the lock is received, i.e. a lock request, and if a request for releasing the lock is received, i.e. an unlock request, checking a lock variable state or updating states of the lock variable in other storage control units is caused. For example, when a lock request is issued from a certain data processing unit and a lock variable held in a storage control unit connected thereto indicates an unlock state, the lock variable state in the other storage control units have to be indexed. Then, if indexing the lock variable states reveals that they are in a lock state, the lock request is returned as failed, and the data processing unit has to issue the lock request, again. These operations are called a spin lock.
As described above, in the prior art, at the time when the data processing unit issues a new lock request, if a lock variable in this storage control unit indicates an unlock state, a lock variable in other storage units must be accessed to acquire a lock. For this reason, a drawback, in the prior art is that a long period of time is required for acquiring the lock; this causes bus traffic to increase due to unnecessary bus access.